'''
Created on 26/09/2012

@author: GabrielBacelar
'''

print 1+1

print 2+2

fruits = ['apple','orange','pear','banana'] #List

print fruits[0] 

pair = (3,5) #Tuple

print pair[0]
x,y = pair
print x
# pair[1] = 6 -> 'tuple' object does not support item assignment



shapes = ['circle','square','triangle','circle']
setOfShapes = set(shapes) #Set
print 'circle' in setOfShapes 
print setOfShapes

studentIds = {'knuth': 42.0, 'turing': 56.0, 'nash': 92.0 } #Dictionary 
print studentIds['turing']
print studentIds
print len(studentIds) #length

print map(lambda x: x * x, [1,2,3])
print filter(lambda x: x > 3, [1,2,3,4,5,4,3,2,1])

#Exercise: List Comprehensions
#Write a list comprehension which, from a list, generates a lowercased version of each string 
#that has length greater than five. You can find the solution in listcomp2.py.

textos = ['paty','patricia','bm','gabriel','bacelar']
textosCaps = []
for texto in textos:
    if len(texto) <= 5:
        textosCaps.append(texto.upper())
    else:
        textosCaps.append(texto.lower())
print textosCaps




